<?php

namespace app\backend\controller;

class ZhTel extends Admin
{
    public function index()
    {
        if (!$this->request->isAjax()) {
            $res = \app\backend\model\ZhTel::where([
                'wxapp_id' => session('backend.wxapp_id')
            ])->find();
            $this->view->assign('info', $res);
            return view('index');
        }
    }

    public function update()
    {
        $id      = $this->request->param('id', '', 'serach_in');
        $content = $this->request->param('content', '', 'serach_in');

        \app\backend\model\ZhTel::where([
            'wxapp_id' => session('backend.wxapp_id'),
            'id'       => $id
        ])->update([
            'updatetime' => time(),
            'content'    => $content
        ]);

        return json(['status' => '00', 'msg' => '保存成功']);
    }
}